package com.zhanghe.im.util;


import com.zhanghe.im.attributes.Attributes;
import io.netty.channel.Channel;
import io.netty.util.Attribute;

/**
 * LoginUtil
 *
 * @author Clevo
 * @date 2018/10/20
 */
public class LoginUtil {

    public static void markLogin(Channel channel){
        channel.attr(Attributes.LOGIN).set(true);
    }

    public static boolean hasLogin(Channel channel){
        Attribute<Boolean> loginAttr = channel.attr(Attributes.LOGIN);
        return loginAttr.get()!=null;
    }
}
